# This patch file was generated by NetBeans IDE # This patch can be applied using context Tools: Apply Diff Patch action on respective folder. # It uses platform neutral UTF-8 encoding. # Above lines and this line are ignored by the patching process. Index: moodle/mod/resource/type/file/resource.class.php --- moodle/mod/resource/type/file/resource.class.php Base (1.71.2.26) +++ moodle/mod/resource/type/file/resource.class.php Locally Modified (Based On 1.71.2.26) @@ -3,6 +3,7 @@ /** * Extend the base resource class for file resources */ + class resource_file extends resource_base { function resource_file($cmid=0) { @@ -12,7 +13,6 @@ var $parameters; var $maxparameters = 5; - /** * Sets the parameters property of the extended class * @@ -230,47 +230,72 @@ if ($resource->options != "forcedownload") { // TODO nicolasconnault 14-03-07: This option should be renamed "embed" if (in_array($mimetype, array('image/gif','image/jpeg','image/png'))) { // It's an image $resourcetype = "image"; + if ($resource->options == "objectframe") {//if "keep navigation" option is set to 'no' or 'frame' + // => Moodle displays the file as unknown type (not embedded into Moodle, the browse select its own player), + //if "keep navigation" option is set to 'without frame' + // => Moodle displays the specific object tag + //Before this fix, all file with types set with $embedded = true where + //always display into their object tag - MDL-20320 $embedded = true; + } } else if ($mimetype == "audio/mp3") { // It's an MP3 audio file $resourcetype = "mp3"; + if ($resource->options == "objectframe") { $embedded = true; + } } else if ($mimetype == "video/x-flv") { // It's a Flash video file $resourcetype = "flv"; + if ($resource->options == "objectframe") { $embedded = true; + } } else if (substr($mimetype, 0, 10) == "video/x-ms") { // It's a Media Player file $resourcetype = "mediaplayer"; + if ($resource->options == "objectframe") { $embedded = true; + } } else if ($mimetype == "video/quicktime") { // It's a Quicktime file $resourcetype = "quicktime"; + if ($resource->options == "objectframe") { $embedded = true; + } } else if ($mimetype == "application/x-shockwave-flash") { // It's a Flash file $resourcetype = "flash"; + if ($resource->options == "objectframe") { $embedded = true; + } } else if ($mimetype == "video/mpeg") { // It's a Mpeg file $resourcetype = "mpeg"; + if ($resource->options == "objectframe") { $embedded = true; + } } else if ($mimetype == "text/html") { // It's a web page $resourcetype = "html"; + //no need embedded, html file types behave like unknown file type } else if ($mimetype == "application/zip") { // It's a zip archive $resourcetype = "zip"; + if ($resource->options == "objectframe") { $embedded = true; + } } else if ($mimetype == 'application/pdf' || $mimetype == 'application/x-pdf') { $resourcetype = "pdf"; - $embedded = true; + //no need embedded, html file types behave like unknown file type + } else if ($mimetype == "audio/x-pn-realaudio") { // It's a realmedia file $resourcetype = "rm"; + if ($resource->options == "objectframe") { $embedded = true; } } + } $isteamspeak = (stripos($resource->reference, 'teamspeak://') === 0); @@ -503,15 +528,12 @@ if ($embedded) { // Display resource embedded in page $strdirectlink = get_string("directlink", "resource"); - if ($inpopup) { - print_header($pagetitle); - } else { $navigation = build_navigation($this->navlinks, $cm); print_header_simple($pagetitle, '', $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm, "self")); - } + if ($resourcetype == "image") { echo '